예제 #1
0
        public void InsertBill(tsysbillcoderule billCodeRule, List<tsysbillcode> lstBillCode)
        {
            try
            {
                dbInstance.BeginTransaction();

                //Insert bill code rule
                localDal.DoInsert<tsysbillcoderule>(billCodeRule);

                //Insert bill code value
                for (int i = 0; i < lstBillCode.Count; i++)
                {
                    localDal.DoInsert<tsysbillcode>(lstBillCode[i]);
                }

                dbInstance.Commit();
            }
            catch (Exception ex)
            {
                dbInstance.Rollback();
                throw ex;
            }
            finally
            {
                dbInstance.CloseConnection();
            }
        }
예제 #2
0
 /// <summary>
 /// Create a new tsysbillcoderule object.
 /// </summary>
 /// <param name="bcrid">Initial value of the bcrid property.</param>
 /// <param name="basevalue">Initial value of the basevalue property.</param>
 /// <param name="ffchars">Initial value of the ffchars property.</param>
 /// <param name="timeformat">Initial value of the timeformat property.</param>
 /// <param name="incrementby">Initial value of the incrementby property.</param>
 /// <param name="lastmodifieduser">Initial value of the lastmodifieduser property.</param>
 /// <param name="lastmodifiedtime">Initial value of the lastmodifiedtime property.</param>
 public static tsysbillcoderule Createtsysbillcoderule(global::System.String bcrid, global::System.String basevalue, global::System.String ffchars, global::System.String timeformat, global::System.Decimal incrementby, global::System.String lastmodifieduser, global::System.DateTime lastmodifiedtime)
 {
     tsysbillcoderule tsysbillcoderule = new tsysbillcoderule();
     tsysbillcoderule.bcrid = bcrid;
     tsysbillcoderule.basevalue = basevalue;
     tsysbillcoderule.ffchars = ffchars;
     tsysbillcoderule.timeformat = timeformat;
     tsysbillcoderule.incrementby = incrementby;
     tsysbillcoderule.lastmodifieduser = lastmodifieduser;
     tsysbillcoderule.lastmodifiedtime = lastmodifiedtime;
     return tsysbillcoderule;
 }
예제 #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the tsysbillcoderule EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotsysbillcoderule(tsysbillcoderule tsysbillcoderule)
 {
     base.AddObject("tsysbillcoderule", tsysbillcoderule);
 }
예제 #4
0
 public void DoUpdateBillCodeRule(ContextInfo contextInfo, tsysbillcoderule bcr, List<tsysbillcode> lstBillCode)
 {
     contextInfo.Action = MES_ActionType.Update;
     BillCodeRuleBll bll = new BillCodeRuleBll(contextInfo);
     bll.CallAccessControl();
     bll.UpdateBill(bcr, lstBillCode);
     GC.Collect();
 }
예제 #5
0
        private string ParseVariables(tsysbillcoderule rule, string timeFormat, string seqNo,List<MESParameterInfo> lstVariablesParameters)
        {
            //predefined:
            //{@TIMEFORMAT}
            //{@SEQUENCE}
            //{@FFCHARS}

            //cust
            //{@PrdTarget}

            string result = rule.billformat.ToLower().Trim();

            for (int i = 0; i < lstVariablesParameters.Count; i++)
            {
                string replaceStr = "{@" + lstVariablesParameters[i].ParamName.ToLower().Trim() + "}";
                string valueStr = lstVariablesParameters[i].ParamValue.Trim();
                result = result.Replace(replaceStr, valueStr);
            }

            string ffchars = rule.ffchars == null || rule.ffchars.Trim() == string.Empty ? string.Empty : rule.ffchars;
            result = result.Replace("{@ffchars}", ffchars);
            result = result.Replace("{@timeformat}", timeFormat);
            result = result.Replace("{@sequence}", seqNo);

            return result;
        }
예제 #6
0
        public void UpdateBill(tsysbillcoderule billCodeRule, List<tsysbillcode> lstBillCode)
        {
            try
            {
                dbInstance.BeginTransaction();

                for (int i = 0; i < lstBillCode.Count; i++)
                {
                    List<MESParameterInfo> lstParameters = new List<MESParameterInfo>()
                    {
                        new MESParameterInfo(){
                            ParamName="bcrid",
                            ParamValue=billCodeRule.bcrid,
                            ParamType="string"
                        }
                    };

                    lstParameters.Add(
                        new MESParameterInfo()
                        {
                            ParamName = "timevalue",
                            ParamValue = lstBillCode[i].timevalue,
                            ParamType = "string"
                        }
                    );

                    if (lstBillCode[i].currentseqvalue <= 0)
                    {
                        localDal.DoDelete<tsysbillcode>(lstParameters);
                    }
                    else
                    {
                        tsysbillcode billCode = localDal.GetSingleObject<tsysbillcode>(lstParameters, string.Empty, true);

                        if (billCode != null)
                        {
                            billCode.bcrid = lstBillCode[i].bcrid;
                            billCode.currentseqvalue = lstBillCode[i].currentseqvalue;
                            billCode.fullbillnotext = lstBillCode[i].fullbillnotext;
                            billCode.isclosed = lstBillCode[i].isclosed;
                            billCode.islocked = lstBillCode[i].islocked;
                            billCode.lockrefid = lstBillCode[i].lockrefid;
                            billCode.prevseqvalue = lstBillCode[i].prevseqvalue;
                            billCode.timevalue = lstBillCode[i].timevalue;
                            billCode.lastmodifiedtime = Function.GetCurrentTime();
                            billCode.lastmodifieduser = CurrentContextInfo.CurrentUser;

                            localDal.DoUpdate<tsysbillcode>(billCode);
                        }
                    }

                }
                //Insert bill code rule
                localDal.DoUpdate<tsysbillcoderule>(billCodeRule);

                dbInstance.Commit();
            }
            catch (Exception ex)
            {
                dbInstance.Rollback();
                throw ex;
            }
            finally
            {
                dbInstance.CloseConnection();
            }
        }