MS CRM ISV CRM Techical Solution Core Microsoft.Crm.MVC on 2010

Microsoft.CRM.MVC is a SSO, CRM Plugin, CRM WebServices, CRM javascript, CRM Business Layer, CRM Protal, CRM MVC, AD MVC, SQL MVC, MOSS MVC Techical Solution, and then it contains some function to process log, config, encrypt, Serializa, import/outport office, ReportingServices ,CRM IFD Solution

 

 

demo代码
    public class BUproductreq : _CrmBusinessUnitBase2<new_productreq>
    {
       
//通过物资申请单更新库存产品相关信息
        public void UpdateStock(Guid id)
        {
            
try
            {
                new_productreq item_productreq 
= Get(id);
                Guid id_warehouse 
= GetID(item_productreq.new_warehouseid);

                Check(id_warehouse, 
"预设仓库不能为空");
                Check(GetInt(item_productreq.new_status) 
== 1"单据不能重复确认");

                List
<new_productreqdetail> list_productreqdetail = call.new_productreqdetail.GetByHeader(id);
                List
<new_stock> list_stock = call.new_stock.GetByWarehouse(id_warehouse);

                
foreach (new_productreqdetail item_productreqdetail in list_productreqdetail)
                {
                    Guid id_product 
= GetID(item_productreqdetail.new_productid);
                    Check(id_product, 
"明细的产品有一个或多个没有选择产品");

                    Check(
!list_stock.Exists((i) =>
                    {
                        
return Exist(i.new_productid);
                    }), 
"物资申请单的产品不在仓库产品列表[" + item_productreqdetail.new_productid.name + "]");

                    
decimal d = 0;
                    Check(list_stock.Exists((i) 
=>
                    {
                        Guid id_p 
= GetID(i.new_productid);
                        
if (id_product == id_p)
                        {
                            
decimal new_quantity = GetDecimal(i.new_quantity) - GetDecimal(item_productreqdetail.new_quantity);
                            
if (new_quantity < 0)
                            {
                                d 
= new_quantity;
                                
return true;
                            }
                        }
                        
return false;
                    }), 
"仓库没有足够的产品库存量[" + item_productreqdetail.new_productid.name + "]数量差[" + (-d).ToString() + "]");

                }

                
foreach (new_productreqdetail item_productreqdetail in list_productreqdetail)
                {
                    Guid id_product 
= GetID(item_productreqdetail.new_productreqid);
                    new_stock item_stock 
= list_stock.Find((i) =>
                    {
                        
return Exist(i.new_productid);
                    });

                    
decimal old_priceunit = GetDecimal(item_stock.new_priceperunit);

                    
//库存量
                    decimal new_quantity = GetDecimal(item_stock.new_quantity) - GetDecimal(item_productreqdetail.new_quantity);
                    
//库存金额
                    decimal new_amount = GetDecimal(item_stock.new_amount) -
                                (GetDecimal(item_stock.new_priceperunit) 
* GetDecimal(item_productreqdetail.new_quantity));
                    
//平均单价,不需重新计算

                    
//保存仓存产品
                    call.new_stock.Update(item_stock);

                    
//锁明细单
                    new_productreqdetail item_productreqdetails = new new_productreqdetail();
                    item_productreqdetails.new_productreqid 
= item_productreqdetails.new_productreqid;
                    item_productreqdetails.new_status 
= GetPicklist(2);
                    item_productreqdetails.new_priceperunit 
= GetMoney(old_priceunit);
                    call.new_productreqdetail.Update(item_productreqdetails);
                }

            }
            
catch (System.Web.Services.Protocols.SoapException ex)
            {
                Exception e1 
= new Exception(ex.Message + " - (SoapException)" + ex.Detail.OuterXml);
                
throw (e1);
            }

        }

    }

 

 

看上去简单但能处理SSO,外带Protal,SQL,CRM的MVC开发

其中两个MOSS和AD的provider不提供.

 

 

 

Builder : Jackson.Lin  Consultant

Corp: GZ.Tectura (share to SH.Tectura, HK.Tectura CRM Team)

posted @ 2010-03-08 20:48  JacksonLin  阅读(455)  评论(0编辑  收藏  举报