Esempio n. 1
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, FeeticketEntity entity)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         entity.Modify(keyValue);
         this.BaseRepository().Update(entity);
     }
     else
     {
         this.BaseRepository().Insert(entity);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 修改发票状态
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <param name="State">状态:100是作废发票,2是已归档,1是已使用</param>
        public void UpdateState(string keyValue, Int16 State)
        {
            if (!string.IsNullOrEmpty(keyValue))
            {
                if (keyValue.IndexOf(',') == -1)
                {
                    FeeticketEntity feeticketEntity = new FeeticketEntity();
                    feeticketEntity.Modify(keyValue);
                    feeticketEntity.ticket_status = State;
                    feeticketEntity.lasttime      = DateTime.Now;
                    feeticketEntity.lastoperate   = OperatorProvider.Provider.Current().UserName;
                    this.BaseRepository().Update(feeticketEntity);
                }
                else
                {
                    string[] keyValues = keyValue.Split(',');
                    string   str       = "";
                    foreach (string item in keyValues)
                    {
                        str += "'" + item + "',";
                    }
                    if (!string.IsNullOrEmpty(str))
                    {
                        str = str.Substring(0, str.Length - 1);
                    }
                    StringBuilder strSql = new StringBuilder();
                    strSql.Append("UPDATE wy_feeticket SET ticket_status=@State,lasttime=GETDATE(),lastoperate=@lastoperate WHERE ticket_id IN (" + str + ")");

                    DbParameter[] parameter =
                    {
                        DbParameters.CreateDbParameter("@State",       State),
                        DbParameters.CreateDbParameter("@lastoperate", OperatorProvider.Provider.Current().UserName)
                    };

                    this.BaseRepository().ExecuteBySql(strSql.ToString(), parameter);
                }
            }
        }