Esempio n. 1
0
        private void updateList(Common.DataBaseOperation DBAction, GenericMaster objData)
        {
            GenericMaster data;

            switch ((int)DBAction)
            {
            case 0:
                ListGenericMaster.Add(objData);
                break;

            case 1:
                data = getDataByCode(objData.GenericCode);
                if (data != null)
                {
                    ListGenericMaster.Remove(data);
                    ListGenericMaster.Add(objData);
                }
                break;

            case 2:
                data = getDataByCode(objData.GenericCode);
                if (data != null)
                {
                    ListGenericMaster.Remove(data);
                }
                break;
            }
        }
        public DataBaseResultSet SaveGenericMaster <T>(T objData) where T : class, IModel, new()
        {
            GenericMaster      obj    = objData as GenericMaster;
            string             sQuery = "sprocGenericMasterInsertUpdateSingleItem";
            List <DbParameter> list   = new List <DbParameter>();

            list.Add(SqlConnManager.GetConnParameters("GenericCode", "GenericCode", 8, GenericDataType.Long, ParameterDirection.Input, obj.GenericCode));
            list.Add(SqlConnManager.GetConnParameters("ICode", "ICode", 13, GenericDataType.String, ParameterDirection.Input, obj.ICode));
            list.Add(SqlConnManager.GetConnParameters("GenericName", "GenericName", 150, GenericDataType.String, ParameterDirection.Input, obj.GenericName));
            list.Add(SqlConnManager.GetConnParameters("NDRX", "NDRX", 3, GenericDataType.String, ParameterDirection.Input, obj.NDRX));
            list.Add(SqlConnManager.GetConnParameters("CUser", "CUser", 8, GenericDataType.Long, ParameterDirection.Input, obj.CUser));
            list.Add(SqlConnManager.GetConnParameters("CDateTime", "CDateTime", 8, GenericDataType.DateTime, ParameterDirection.Input, obj.CDateTime));
            list.Add(SqlConnManager.GetConnParameters("EUser", "EUser", 8, GenericDataType.Long, ParameterDirection.Input, obj.EUser));
            list.Add(SqlConnManager.GetConnParameters("EDateTime", "EDateTime", 8, GenericDataType.DateTime, ParameterDirection.Input, obj.EDateTime));
            list.Add(SqlConnManager.GetConnParameters("LCode", "LCode", 8, GenericDataType.Long, ParameterDirection.Input, obj.LCode));
            list.Add(SqlConnManager.GetConnParameters("DLock", "DLock", 3, GenericDataType.String, ParameterDirection.Input, obj.DLock));
            list.Add(SqlConnManager.GetConnParameters("SchH1", "SchH1", 3, GenericDataType.String, ParameterDirection.Input, obj.SchH1));
            list.Add(SqlConnManager.GetConnParameters("CreatedBy", "CreatedBy", 50, GenericDataType.String, ParameterDirection.Input, obj.CreatedBy));
            list.Add(SqlConnManager.GetConnParameters("CreatedDate", "CreatedDate", 8, GenericDataType.DateTime, ParameterDirection.Input, obj.CreatedDate));
            list.Add(SqlConnManager.GetConnParameters("UpdateddBy", "UpdateddBy", 50, GenericDataType.String, ParameterDirection.Input, obj.UpdateddBy));
            list.Add(SqlConnManager.GetConnParameters("UpdatedDate", "UpdatedDate", 8, GenericDataType.DateTime, ParameterDirection.Input, obj.UpdatedDate));
            list.Add(SqlConnManager.GetConnParameters("UpdatedCount", "UpdatedCount", 4, GenericDataType.Int, ParameterDirection.Input, obj.UpdatedCount));
            list.Add(SqlConnManager.GetConnParameters("LUT", "LUT", 8, GenericDataType.DateTime, ParameterDirection.Input, obj.LUT));
            list.Add(SqlConnManager.GetConnParameters("OperationFlag", "OperationFlag", 4, GenericDataType.Int, ParameterDirection.Input, (short)obj.OperationFlag));
            list.Add(SqlConnManager.GetConnParameters("Message", "Message", 300, GenericDataType.String, ParameterDirection.Output, null));
            list.Add(SqlConnManager.GetConnParameters("ErrorCode", "ErrorCode", 4, GenericDataType.Int, ParameterDirection.Output, null));
            return(SqlConnManager.Save(sQuery, CommandType.StoredProcedure, list.ToArray()));
        }
        public void GetListGenericMaster <T>(T objFilter, ref List <T> listData) where T : class, IModel, new()
        {
            string             sQuery  = "GetListGenericMaster";
            GenericMaster      objData = objFilter as GenericMaster;
            List <DbParameter> list    = new List <DbParameter>();

            list.Add(SqlConnManager.GetConnParameters("GenericCode", "GenericCode", 8, GenericDataType.Long, ParameterDirection.Input, objData.GenericCode));
            SqlConnManager.GetList <T>(sQuery, CommandType.StoredProcedure, list.ToArray(), FillGenericMasterDataFromReader, ref listData);
        }
 private void FillGenericMasterDataFromReader <T>(DbDataReader DbReader, ref List <T> listData) where T : class, IModel, new()
 {
     while (DbReader.Read())
     {
         T             obj     = new T();
         GenericMaster objData = obj as GenericMaster;
         obj.FillDataFromDB(DbReader);
         listData.Add(obj);
     }
 }
Esempio n. 5
0
        public void SearchData()
        {
            GenericMaster data = getDataByCode(this.Search);

            if (data != null)
            {
                this.Clone <GenericMaster>(data);
                this.IsModifyData = true;
            }
        }
Esempio n. 6
0
        private string dataBaseAction(Common.DataBaseOperation DBAction)
        {
            string        sMsg    = string.Empty;
            GenericMaster objData = this.Copy <GenericMaster>();

            objData.OperationFlag = DBAction;

            DataBaseResultSet DBRS = BLL.BllClient.objBllClient.Save <GenericMaster>(Common.DataSourceTypes.GenericMasterSave, objData);

            sMsg = CommonModel.GetOperationMessage <GenericMaster>(DBRS, objData);
            if (DBRS.ErrorCode == 0)
            {
                updateList(DBAction, objData);
                this.ResetData();
            }

            return(sMsg);
        }
        private void GenericMasterMenuItem_Click(object sender, RoutedEventArgs e)
        {
            GenericMaster MstCompanyDetail = new GenericMaster();

            MstCompanyDetail.ShowDialog();
        }