コード例 #1
0
ファイル: DataModel.cs プロジェクト: SparkZG/CallCRM
        public void SetData(DataRow dr)
        {
            ID       = Convert.ToInt32(dr["ID"]);
            CallType = Convert.ToInt32(dr["CallType"]);
            Chan     = Convert.ToInt32(dr["Chan"]);

            LineID       = dr["LineID"].ToString();
            CallerID     = dr["CallerID"].ToString();
            StartDate    = Convert.ToDateTime(dr["StartDate"]).Date;
            StartTime    = dr["StartTime"].ToString();
            DuringTime   = dr["DuringTime"].ToString();
            WaveFilePath = BLLCommon.GetWavPath() + dr["WaveFilePath"].ToString();
            if (dr["IsDisposed"].ToString() == "")
            {
                IsDisposed = 0;
            }
            else
            {
                IsDisposed = Convert.ToInt32(dr["IsDisposed"]);
            }

            //如果access里面数据是未接听
            if (CallType == 0 && IsDisposed == 0)
            {
                IsDisposed = 1;
                CreteFaultList.UpdateIsCreate(ID, FaultType.Pending);
            }
            if (CallType == 2)
            {
                WaveFilePath = "";
            }
        }
コード例 #2
0
ファイル: BSViewModel.cs プロジェクト: SparkZG/CallCRM
        public bool CreateFaultOrder(FaultType _type)
        {
            var fdm = new FaultDataModel();

            if (User == null)
            {
                //不能创建
                Prompt = "报修人员未选择!";
                return(false);
            }
            else
            {
                fdm.user_id = User.Key;
            }

            if (Department == null)
            {
                //不能创建
                Prompt = "请选择部门!";
                return(false);
            }
            else
            {
                fdm.department_id = Department.Key;
            }

            if (AssetType == null)
            {
                //不能创建
                Prompt = "资产类型未选择!";
                return(false);
            }
            else
            {
                fdm.asset_type_id = AssetType.Key;
            }

            if (Company == null)
            {
                //不能创建
                Prompt = "请选择区域!";
                return(false);
            }
            else
            {
                fdm.company_id = Company.Key;
            }

            if (OrderType == null)
            {
                //不能创建
                Prompt = "请选择工单类型!";
                return(false);
            }
            else
            {
                fdm.work_property = OrderType.Text;
            }

            //故障类型
            if (BreakDownCate == null)
            {
                fdm.breakdown_categ = FaultDict[2].Text;
            }
            else
            {
                fdm.breakdown_categ = BreakDownCate.Text;
            }

            //故障主题------------(-1可能导致外键错误)
            if (KnowLedge == null)
            {
                fdm.knowledge_id = 0;
            }
            else
            {
                fdm.knowledge_id = KnowLedge.Key;
            }

            //去除换行符
            Regex reg = new Regex(@"\b\r\n");

            fdm.note        = reg.Replace(Note, ";");
            fdm.address     = reg.Replace(Address, ";");
            fdm.note_result = reg.Replace(Note_Result, ";");


            //设置录音记录信息
            fdm.SetData(_DataModel);


            //这里地址需要加上ip地址(目前不需要加IP了)
            //string ipStr = Provider.getIPAddress();
            //if (ipStr == Properties.Settings.Default.ServerIP)
            //{
            fdm.WaveFilePath = WaveFilePath;
            //}
            //else
            //{
            //    fdm.WaveFilePath = ipStr + "\\" + WaveFilePath;
            //}


            //插入服务器

            if (CreteFaultList.CreateOrder(fdm, _type, IsInsert))
            {
                CreteFaultList.UpdateIsCreate(AccessID, _type);
                return(true);
            }
            return(false);
        }
コード例 #3
0
ファイル: BSViewModel.cs プロジェクト: SparkZG/CallCRM
        public void GetCall_logData()
        {
            DataTable callData = CreteFaultList.GetOrder(AccessID, CallerID);

            if (callData.Rows.Count > 0)
            {
                //update
                IsInsert = false;
                DataRow dr = callData.Rows[0];

                if (dr["user_id"] != null)
                {
                    var skvUser = UserDict.Find(skv => skv.Key == Convert.ToInt32(dr["user_id"]));
                    if (skvUser != null)
                    {
                        User = skvUser;
                    }
                }

                if (dr["department_id"] != null)
                {
                    var skvDepartment = DepartmentDict.Find(skv => skv.Key == Convert.ToInt32(dr["department_id"]));
                    if (skvDepartment != null)
                    {
                        Department = skvDepartment;
                    }
                }


                if (dr["asset_type_id"] != null)
                {
                    var skvAsset = AssetTypeDict.Find(skv => skv.Key == Convert.ToInt32(dr["asset_type_id"]));
                    if (skvAsset != null)
                    {
                        AssetType = skvAsset;
                    }
                }

                if (dr["breakdown_categ"] != null)
                {
                    var skvFault = FaultDict.Find(skv => skv.Text == Convert.ToString(dr["breakdown_categ"]));
                    if (skvFault != null)
                    {
                        BreakDownCate = skvFault;
                    }
                }

                if (dr["company_id"] != null)
                {
                    var skvCompany = CompanyDict.Find(skv => skv.Key == Convert.ToInt32(dr["company_id"]));
                    if (skvCompany != null)
                    {
                        Company = skvCompany;
                    }
                }

                if (dr["work_property"] != null)
                {
                    var skvOrder = OrderDict.Find(skv => skv.Text == Convert.ToString(dr["work_property"]));
                    if (skvOrder != null)
                    {
                        OrderType = skvOrder;
                    }
                }

                if (dr["knowledge_id"] != null)
                {
                    var skvKnow = KnowLedgeDict.Find(skv => skv.Key == Convert.ToInt32(dr["knowledge_id"]));
                    if (skvKnow != null)
                    {
                        KnowLedge = skvKnow;
                    }
                }

                if (dr["note_result"] != null)
                {
                    Note_Result = Convert.ToString(dr["note_result"]);
                }
                if (dr["address"] != null)
                {
                    Address = Convert.ToString(dr["address"]);
                }
                if (dr["note"] != null)
                {
                    Note = Convert.ToString(dr["note"]);
                }

                //更新access数据库和web服务器状态一致
                if (dr["state"] != null)
                {
                    if (_DataModel.IsDisposed != Convert.ToInt32(dr["state"]))
                    {
                        _DataModel.IsDisposed = Convert.ToInt32(dr["state"]);
                        CreteFaultList.UpdateIsCreate(AccessID, CreteFaultList.GetFaultType(_DataModel.IsDisposed.ToString()));
                    }
                }
            }
        }