Exemplo n.º 1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         Entity.TemplateMaster objConfigurationHead = new Entity.TemplateMaster();
         if (hfPKEdit.Value != "0")
         {
             if (!(IsUpdate && Event.Find(x => x.EventName.Contains("Update")) != null))
             {
                 msg.GetMsg(this.Page, "TemplateMaster", "UR");
                 return;
             }
             objConfigurationHead.TemplateDropDownId = hfPKEdit.Value.ToInt32();
             objConfigurationHead.EventId            = Event.Find(x => x.EventName.Contains("Update")).EventId;
         }
         else
         {
             if (!(IsInsert && Event.Find(x => x.EventName.Contains("Insert")) != null))
             {
                 msg.GetMsg(this.Page, "TemplateMaster", "SR");
                 return;
             }
             objConfigurationHead.TemplateDropDownId = 0;
             objConfigurationHead.EventId            = Event.Find(x => x.EventName.Contains("Insert")).EventId;
         }
         objConfigurationHead.TemplateDropdownName = txttemplatename.Text;
         objConfigurationHead.UserId        = 0;
         objConfigurationHead.EventId       = 0;
         objConfigurationHead.HostName      = "";
         objConfigurationHead.IpAddr        = "";
         objConfigurationHead.TransactionId = "";
         int check = BAL.TemplateMastermgmt.AddUpdateTemplateMaster(objConfigurationHead);
         if (check > 0)
         {
             if (hfPKEdit.Value != "0")
             {
                 msg.GetMsg(this.Page, "TemplateMaster", "U");
                 Clrscr();
                 GetListData();
             }
             else
             {
                 msg.GetMsg(this.Page, "TemplateMaster", "I");
                 Clrscr();
                 GetListData();
             }
         }
         else if (check == -1)
         {
             msg.GetMsg(this.Page, "TemplateMaster", "AE");
         }
         else
         {
             msg.GetMsg(this.Page, "TemplateMaster", "E");
         }
     }
 }
 public void FillTemplateMasterParams(SqlParameterCollection parameters, Entity.TemplateMaster Entity)
 {
     parameters.AddWithValue("@TemplateDropDownId", Entity.TemplateDropDownId);
     parameters.AddWithValue("@TemplateDropdownName", Entity.TemplateDropdownName);
     //parameters.AddWithValue("@CreatedBy", Entity.CreatedBy);
     parameters.AddWithValue("@UserId", Entity.UserId);
     parameters.AddWithValue("@HostName", Entity.HostName);
     parameters.AddWithValue("@IpAddr", Entity.IpAddr);
     parameters.AddWithValue("@EventId", Entity.EventId);
     parameters.AddWithValue("@TransactionId", Entity.TransactionId);
 }
        public virtual int AddUpdateTemplateMaster(Entity.TemplateMaster Entity)
        {
            SqlCommand cmdInsert = new SqlCommand();

            cmdInsert.CommandType    = CommandType.StoredProcedure;
            cmdInsert.CommandTimeout = 0;
            cmdInsert.CommandText    = "dbo.AddUpdateTemplateMaster";
            this.FillTemplateMasterParams(cmdInsert.Parameters, Entity);
            int res = this.ExecuteNonQuery(cmdInsert);

            base.ForceCloseConnection(cmdInsert);
            return(res);
        }
        public virtual List <Entity.TemplateMaster> GetTemplateMasterData(int Id, int IsActive)
        {
            List <Entity.TemplateMaster> lstConfigurationHead = new List <Entity.TemplateMaster>();

            SqlCommand cmdSelect = new SqlCommand();

            cmdSelect.CommandType    = CommandType.StoredProcedure;
            cmdSelect.CommandTimeout = 0;
            cmdSelect.CommandText    = "dbo.Get_TemplateMasterData";
            cmdSelect.Parameters.AddWithValue("@Id", Id);
            cmdSelect.Parameters.AddWithValue("@IsActive", IsActive);
            SqlDataReader dr = this.ExecuteDataReader(cmdSelect);

            while (dr.Read())
            {
                Entity.TemplateMaster objConfigurationHead = new Entity.TemplateMaster();
                lstConfigurationHead.Add(objConfigurationHead);
                this.FillEntityTemplateData(dr, objConfigurationHead, 0);
            }
            base.ForceCloseConnection(cmdSelect);
            return(lstConfigurationHead);
        }
 protected void FillEntityTemplateData(IDataReader dr, Entity.TemplateMaster ObjConfigurationHead, int Type)
 {
     ObjConfigurationHead.TemplateDropDownId   = GetFieldInt(dr, "TemplateDropDownId");
     ObjConfigurationHead.TemplateDropdownName = GetField(dr, "TemplateDropdownName");
 }
Exemplo n.º 6
0
 public static int AddUpdateTemplateMaster(Entity.TemplateMaster Entity)
 {
     return(new DAL.TemplateMasterSQL().AddUpdateTemplateMaster(Entity));
 }