Example #1
0
        public override Model.DealResult UndoMake(BaseData bd, Model.Synergismlogdt dt)
        {
            Model.DealResult dr      = new Model.DealResult();
            Model.APIData    apidata = bd as Model.APIData;
            try
            {
                CancelAudit(apidata, dt);
            }
            catch (Exception ex)
            {
                Log.WriteWinLog("purchaseop_cancelaudit:" + ex.ToString());
                dr.ResultNum = -1;
                dr.ResultMsg = ex.Message;
                return(dr);
            }
            BusinessObject domHead = null;
            BusinessObject domBody = null;

            LoadVouch(apidata, dt, out domHead, out domBody);
            string vouchid = GetCodeorID(dt.Cvoucherno, apidata, "id");

            U8Login.clsLogin u8Login = new U8Login.clsLogin();
            dr = GetU8Login(apidata, u8Login);
            if (dr.ResultNum < 0)
            {
                return(dr);
            }
            U8ApiBroker broker = null;

            dr = GetU8ApiBroker(apidata, u8Login, out broker, "delete");
            if (dr.ResultNum < 0)
            {
                return(dr);
            }
            broker.SetBoParam("domHead", domHead);
            try
            {
                broker.SetBoParam("domBody", domBody);
            }
            catch { }

            MSXML2.IXMLDOMDocument2 CurDom = new MSXML2.DOMDocument();
            broker.AssignNormalValue("CurDom", CurDom);
            if (!broker.Invoke())
            {
                Exception apiEx = broker.GetException();
                if (apiEx != null)
                {
                    if (apiEx is MomSysException)
                    {
                        MomSysException sysEx = apiEx as MomSysException;

                        dr.ResultNum = -1;
                        dr.ResultMsg = "系统异常:" + sysEx.Message;
                    }
                    else if (apiEx is MomBizException)
                    {
                        MomBizException bizEx = apiEx as MomBizException;


                        dr.ResultNum = -1;
                        dr.ResultMsg = "API异常:" + bizEx.Message;
                    }

                    String exReason = broker.GetExceptionString();
                    if (exReason.Length != 0)
                    {
                        dr.ResultNum = -1;
                        dr.ResultMsg = " 异常原因:" + exReason;
                    }
                }

                broker.Release();

                return(dr);
            }
            System.String result = broker.GetReturnValue() as System.String;
            if (result != null)
            {
                dr.ResultNum = -1;
                dr.ResultMsg = "API错误:" + result;
                throw new Exception("API错误:" + result);
            }
            broker.Release();

            DAL.Regist   registdal = new DAL.Regist();
            Model.Regist regist    = registdal.GetModel(dt.Accid); //acccode 转 accid
            return(dr);
        }
Example #2
0
        public List <Model.Synergismlogdt> DataTableToListAccname(DataTable dt)
        {
            DAL.Regist registdal = new DAL.Regist();

            List <Model.Synergismlogdt> modelList = new List <Model.Synergismlogdt>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Model.Synergismlogdt model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Model.Synergismlogdt();
                    if (dt.Rows[n]["autoid"].ToString() != "")
                    {
                        model.Autoid = dt.Rows[n]["autoid"].ToString();  //int.Parse(dt.Rows[n]["autoid"].ToString());
                    }
                    model.Cerrordesc = dt.Rows[n]["cerrordesc"].ToString();
                    model.Cstatus    = dt.Rows[n]["cstatus"].ToString();
                    if (dt.Rows[n]["ismanual"].ToString() != "")
                    {
                        model.Ismanual = int.Parse(dt.Rows[n]["ismanual"].ToString());
                    }
                    if (dt.Rows[n]["isaudit"].ToString() != "")
                    {
                        model.Isaudit = int.Parse(dt.Rows[n]["isaudit"].ToString());
                    }
                    if (dt.Rows[n]["errortimes"].ToString() != "")
                    {
                        model.Errortimes = int.Parse(dt.Rows[n]["errortimes"].ToString());
                    }
                    if (dt.Rows[n]["cdealmothed"].ToString() != "")
                    {
                        model.Cdealmothed = int.Parse(dt.Rows[n]["cdealmothed"].ToString());
                    }
                    if (dt.Rows[n]["id"].ToString() != "")
                    {
                        model.Id = dt.Rows[n]["id"].ToString(); //int.Parse(dt.Rows[n]["id"].ToString());
                    }

                    if (dt.Rows[n]["fatherid"].ToString() != "")
                    {
                        model.Fatherid = int.Parse(dt.Rows[n]["fatherid"].ToString());
                    }

                    if (dt.Rows[n]["ilineno"].ToString() != "")
                    {
                        model.Ilineno = int.Parse(dt.Rows[n]["ilineno"].ToString());
                    }
                    model.Accid = dt.Rows[n]["accid"].ToString();

                    model.Accname = registdal.GetModel(model.Accid).Cacc_id;


                    model.Cvouchertype = dt.Rows[n]["cvouchertype"].ToString();
                    model.Cvoucherno   = dt.Rows[n]["cvoucherno"].ToString();
                    model.Cpk          = dt.Rows[n]["cpk"].ToString();
                    if (dt.Rows[n]["dinputtime"].ToString() != "")
                    {
                        model.Dinputtime = DateTime.Parse(dt.Rows[n]["dinputtime"].ToString());
                    }
                    if (dt.Rows[n]["dmaketime"].ToString() != "")
                    {
                        model.Dmaketime = DateTime.Parse(dt.Rows[n]["dmaketime"].ToString());
                    }
                    if (model.Cstatus == "错误")
                    {
                        model.Opname = "重发";
                    }
                    if (model.Cstatus == "已删除")
                    {
                        model.Opname = "重发";
                    }


                    if (model.Ismanual == 1)
                    {
                        model.Ismanualc = "是";
                    }
                    else
                    {
                        model.Ismanualc = "否";
                    }


                    if (model.Isaudit == 1)
                    {
                        model.Isauditc = "是";
                    }
                    else
                    {
                        model.Isauditc = "否";
                    }

                    model.Cvouchertypename = dt.Rows[n]["Cvouchertypename"].ToString();



                    modelList.Add(model);
                }
            }
            return(modelList);
        }