コード例 #1
0
ファイル: ModelManager.cs プロジェクト: wra222/testgit
        //for liu jing-ke 2010/4/7 return null, i dont use it
        public ModelMaintainInfo GetModel(string strModelName)
        {
            ModelMaintainInfo model = new ModelMaintainInfo();

            try
            {
                Model modelObj = modelRepository.Find(strModelName);

                if (modelObj == null)
                {
                    return null;
                }
                else
                {
                    model = convertToModelMaintainInfoFromModelObj(modelObj);
                }
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw;
            }

            return model;
        }
コード例 #2
0
ファイル: ModelManager.cs プロジェクト: wra222/testgit
        //model
        public IList<ModelMaintainInfo> GetModelList(string FamilyId)
        {
            IList<ModelMaintainInfo> modelList = new List<ModelMaintainInfo>();
            try
            {
                IList<Model> tmpModelList = modelRepository.GetModelObjList(FamilyId);

                foreach (Model temp in tmpModelList)
                {
                    ModelMaintainInfo model = new ModelMaintainInfo();

                    model = convertToModelMaintainInfoFromModelObj(temp);

                    modelList.Add(model);
                }
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw;
            }

            return modelList;
        }
コード例 #3
0
ファイル: ModelRepositoryEx.cs プロジェクト: wra222/testgit
        public IList<ModelMaintainInfo> GetModelListByPartialModelNo(string modelNo, int rowCount)
        { 
            try
            {
                IList<ModelMaintainInfo> ret = new List<ModelMaintainInfo>();
                string SQLStatement = @"select top {1} Model, Family, CustPN, Region, ShipType, Status, OSCode, OSDesc, Price, BOMApproveDate, Editor, Cdt, Udt
                                        from Model NOLOCK where Model like '%{0}%' order by Model";

                SQLStatement = string.Format(SQLStatement, modelNo, rowCount.ToString());

                using (DataTable dt = _Schema.SqlHelper.ExecuteDataFill(_Schema.SqlHelper.ConnectionString_GetData,
                                                                                                                             CommandType.Text, SQLStatement))
                {
                    if(dt.Rows.Count>0)
                    {
                        foreach(DataRow dr in dt.Rows)
                        {
                            ModelMaintainInfo m = new ModelMaintainInfo();
                            m.Model = ObjToString(dr["Model"]);
                            m.Family = ObjToString(dr["Family"]);
                            m.CustPN = ObjToString(dr["CustPN"]);
                            m.Region = ObjToString(dr["Region"]);
                            m.ShipType = ObjToString(dr["ShipType"]);
                            m.Status = ObjToString(dr["Status"]);
                            m.OsCode = ObjToString(dr["OSCode"]);
                            m.OSDesc = ObjToString(dr["OSDesc"]);
                            m.Price = ObjToString(dr["Price"]);
                            
                            if (!"".Equals(ObjToString(dr["BOMApproveDate"])))
                                m.BomApproveDate = (DateTime)dr["BOMApproveDate"];
                            m.Editor = ObjToString(dr["Editor"]);
                            if (!"".Equals(ObjToString(dr["Cdt"])))
                                m.Cdt = (DateTime) dr["Cdt"];
                            if (!"".Equals(ObjToString(dr["Udt"])))
                                m.Udt = (DateTime) dr["Udt"]; 
                            ret.Add(m);
                        }
                    }
                }
                return ret;
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #4
0
ファイル: ModelMaintain.aspx.cs プロジェクト: wra222/testgit
    protected void btnSave_Click(Object sender, EventArgs e)
    {
        string modelName;
        try
        {
            string family = this.cmbFamily.SelectedValue;
            modelName = txtModel.Text.ToUpper();

            if (!hidModelName.Value.Equals(modelName)) // && iModelManagerEx.ModelExist(modelName))
            {
                showErrorMessage(this.GetLocalResourceObject(Pre + "_ErrSaveNewModel").ToString());
                return;
            }

            string custPN = txtCustPN.Text;
            string region = CmbRegion.SelectedValue;
            string shiptype = CmbShipType.SelectedValue;
            string status = selStatus.SelectedValue;
            string osCode = cmbOSCode.SelectedItem.Text;
            string osDesc = this.hidDescr.Value;
            string oldModelName = hidModelName.Value;

            ModelMaintainInfo model = new ModelMaintainInfo();

            model.Model = modelName;
            model.CustPN = custPN;
            model.Region = region;
            model.ShipType = shiptype;
            model.Status = status;
            model.OsCode = osCode;
            model.OSDesc = osDesc;
            model.Family = family;
            model.Editor = editor;


            iModelManager.SaveModel(model, oldModelName);
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            return;

        }
        catch (Exception ex)
        {
            showErrorMessage(ex.Message);
            return;
        }

        bindTable();
        ScriptManager.RegisterStartupScript(this.updatePanel3, typeof(System.Object), "SaveComplete", "SaveComplete(\"" + modelName + "\");", true);
    }
コード例 #5
0
ファイル: ModelManager.cs プロジェクト: wra222/testgit
        public IList<ModelMaintainInfo> GetModelListByModel(string strFamilyName, string strModelName)
        {
            FisException ex;
            List<string> paraError = new List<string>();

            IList<ModelMaintainInfo> modelList = new List<ModelMaintainInfo>();

            try
            {
                IList<Model> tmpModelList = modelRepository.GetModelListByModel(strFamilyName, strModelName.ToUpper());

                if (tmpModelList.Count() == 0) 
                {
                    ex = new FisException("DMT010", paraError);//new SystemException("There is the same Rule!");//
                    throw ex;
                }

                foreach (Model temp in tmpModelList)
                {
                    ModelMaintainInfo model = new ModelMaintainInfo();

                    model = convertToModelMaintainInfoFromModelObj(temp);

                    modelList.Add(model);
                }
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw;
            }

            return modelList;
        }
コード例 #6
0
ファイル: ModelManager.cs プロジェクト: wra222/testgit
        private Model convertToModelObjFromModelMaintainInfo(ModelMaintainInfo temp)
        {
            Model model = new Model();

            model.ModelName = temp.Model;
            model.CustPN = temp.CustPN;
            model.Region = temp.Region;
            model.ShipType = temp.ShipType;
            model.Status = temp.Status;
            model.OSCode = temp.OsCode;
            model.OSDesc = temp.OSDesc;
            model.Price = temp.Price;
            model.BOMApproveDate = temp.BomApproveDate;
            model.Editor = temp.Editor;
            model.Cdt = temp.Cdt;
            model.Udt = temp.Udt;
            model.FamilyName = temp.Family;

            return model;
        }
コード例 #7
0
ファイル: ModelManager.cs プロジェクト: wra222/testgit
        public void SaveModelPrice(ModelMaintainInfo modelInfo)
        {
            try
            {
                Model model = modelRepository.Find(modelInfo.Model);
                model.Price = modelInfo.Price;
                model.Editor = modelInfo.Editor;
                
                IUnitOfWork work = new UnitOfWork();

                modelRepository.ChangeModelDefered(work, model, modelInfo.Model);

                work.Commit();
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw;
            }

        }
コード例 #8
0
ファイル: ModelManager.cs プロジェクト: wra222/testgit
        public void SaveModel(ModelMaintainInfo modelInfo, string oldModelName)
        {
            try
            {
                Model modelObj = convertToModelObjFromModelMaintainInfo(modelInfo);

                IUnitOfWork work = new UnitOfWork();

                modelRepository.ChangeModelDefered(work, modelObj, oldModelName);

                //删除model_process表
                processRepository.DeleteModelProcessByModelDefered(work, oldModelName);

                work.Commit();
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw;
            }

        }
コード例 #9
0
ファイル: ModelManager.cs プロジェクト: wra222/testgit
        public void AddModel(ModelMaintainInfo modelInfo)
        {
            try
            {
                Model modelObj = convertToModelObjFromModelMaintainInfo(modelInfo);

                IUnitOfWork work = new UnitOfWork();

                modelRepository.Add(modelObj, work);

                work.Commit();
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw;//new SystemException(e.Message);
            }

        }
コード例 #10
0
 /// <summary>
 /// 判断输入的code是否在数据库的model或者CPQSNO中
 /// </summary>
 /// <param name="Code"></param>
 /// <returns></returns>
 private bool CheckIsInModelOrCPQSNO(ModelMaintainInfo model, string Code)
 {
     if (model == null && (!runInTimeControlManager.IfProductIsExists(Code)))
     {
         return false;
     }
     else
     {
         return true;
     }
 }