Beispiel #1
0
        public static void WholeUpdateSoState(int soId, int userid, SoStatesEnum state)
        {
            List <string> strSqls = new List <string>();

            if (state == SoStatesEnum.Approved)
            {
                strSqls.Add(string.Format("update so set soStates={0},approverId={1},approveDate='{2}' where soId={3}", (int)state, userid, DateTime.Now.ToShortDateString(), soId));
                strSqls.Add(string.Format("update soItems set soItemState={0} where soId={1}", new SoItemApprove().GetStateValue(), soId));
            }
            else if (state == SoStatesEnum.Rejected || state == SoStatesEnum.Cancel || state == SoStatesEnum.Closed)
            {
                strSqls.Add(string.Format("update so set soStates={0} where soId={1}", (int)state, soId));
                int value = 0;
                if (state == SoStatesEnum.Rejected)
                {
                    value = new SoItemRejected().GetStateValue();
                }
                else if (state == SoStatesEnum.Cancel)
                {
                    value = new SoItemCancelled().GetStateValue();
                }
                else
                {
                    value = new SoItemClose().GetStateValue();
                }


                strSqls.Add(string.Format("update soItems set soItemState={0} where soId={1}", value, soId));
            }
            else
            {
                strSqls.Add(string.Format("update so set soStates={0} where soId={1}", (int)state, soId));
            }
            db.ExecDataBySqls(strSqls);
        }
Beispiel #2
0
        public static void WholeUpdateSoState(int soId, int userid, SoStatesEnum state)
        {
            List<string> strSqls = new List<string>();
               if (state ==SoStatesEnum.Approved)
               {
               strSqls.Add(string.Format("update so set soStates={0},approverId={1},approveDate='{2}' where soId={3}", (int)state, userid, DateTime.Now.ToShortDateString(), soId));
               strSqls.Add(string.Format("update soItems set soItemState={0} where soId={1}",new SoItemApprove().GetStateValue(),soId));

               }
               else if (state == SoStatesEnum.Rejected || state == SoStatesEnum.Cancel||state==SoStatesEnum.Closed)
               {
               strSqls.Add(string.Format("update so set soStates={0} where soId={1}", (int)state, soId));
               int value = 0;
               if (state == SoStatesEnum.Rejected) value = new SoItemRejected().GetStateValue();
               else if (state == SoStatesEnum.Cancel) value = new SoItemCancelled().GetStateValue();
               else value = new SoItemClose().GetStateValue();

               strSqls.Add(string.Format("update soItems set soItemState={0} where soId={1}",value,soId));
               }
               else
               {
              strSqls.Add(string.Format("update so set soStates={0} where soId={1}", (int)state, soId));

               }
              db.ExecDataBySqls(strSqls);
        }