protected void btnSave_Click(object sender, EventArgs e) { employeewagesMaster objemployee = new employeewagesMaster(); objemployee.eid = Convert.ToInt64(hfcustomer.Value); objemployee.firstcount = Convert.ToInt32(txtfirstcount.Text); objemployee.firstrate = Convert.ToDecimal(txtfirstrate.Text); objemployee.secondrate = Convert.ToDecimal(txtsecondrate.Text); objemployee.vshaperate = Convert.ToDecimal(txtvshaperate.Text); objemployee.silairate = Convert.ToDecimal(txtsilairate.Text); objemployee.currentfirstrate = Convert.ToDecimal(txtcurrentfirstrate.Text); objemployee.currentsecondrate = Convert.ToDecimal(txtcurrentsecondrate.Text); objemployee.currentsilairate = Convert.ToDecimal(txtcurrentsilairate.Text); objemployee.currentvshaperate = Convert.ToDecimal(txtcurrentvshaperate.Text); if (Session["update"] != null) { if (Convert.ToBoolean(Session["update"])) { if (Session["id"] != null) { objemployee.id = Convert.ToInt64(Session["id"]); } Result = new Cls_employeewages_b().Update(objemployee); Session["update"] = false; if (Result > 0) { //update = false; Clear(); spnMessage.InnerText = "Employee Wages Updated Successfully !!!"; BindWages(); //Response.Redirect(Page.ResolveUrl("~/manageEmployee.aspx?mode=i")); } else { Clear(); spnMessage.Style.Add("color", "red"); spnMessage.InnerText = "Employee Wages Not Updated..."; } } } else { Result = new Cls_employeewages_b().Insert(objemployee); if (Result > 0) { Clear(); spnMessage.InnerText = "Employee Wages Saved Successfully !!!"; BindWages(); //Response.Redirect(Page.ResolveUrl("~/manageEmployee.aspx?mode=i")); } else { Clear(); spnMessage.Style.Add("color", "red"); spnMessage.InnerText = "Employee Wages Not Saved..."; } } }
public employeewagesMaster SelectById(Int64 cid) { SqlDataAdapter da; DataSet ds = new DataSet(); employeewagesMaster objcategory = new employeewagesMaster(); try { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "employeewages_SelectById"; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = ConnectionString; cmd.Parameters.AddWithValue("@id", cid); ConnectionString.Open(); da = new SqlDataAdapter(cmd); da.Fill(ds); if (ds != null) { if (ds.Tables.Count > 0) { if (ds.Tables[0] != null) { if (ds.Tables[0].Rows.Count > 0) { { objcategory.id = Convert.ToInt64(ds.Tables[0].Rows[0]["id"]); objcategory.eid = Convert.ToInt64(ds.Tables[0].Rows[0]["empid"]); //objcategory.employeename = Convert.ToString(ds.Tables[0].Rows[0]["employeename"]); objcategory.createddate = Convert.ToString(ds.Tables[0].Rows[0]["createddate"]); objcategory.firstcount = Convert.ToInt32(ds.Tables[0].Rows[0]["firstcount"]); objcategory.firstrate = Convert.ToDecimal(ds.Tables[0].Rows[0]["firstrate"]); objcategory.secondrate = Convert.ToDecimal(ds.Tables[0].Rows[0]["secondrate"]); objcategory.vshaperate = Convert.ToDecimal(ds.Tables[0].Rows[0]["vshaperate"]); objcategory.silairate = Convert.ToDecimal(ds.Tables[0].Rows[0]["silairate"]); objcategory.currentfirstrate = Convert.ToDecimal(ds.Tables[0].Rows[0]["currentfirstrate"]); objcategory.currentsecondrate = Convert.ToDecimal(ds.Tables[0].Rows[0]["currentsecondrate"]); objcategory.currentvshaperate = Convert.ToDecimal(ds.Tables[0].Rows[0]["currentvshaperate"]); objcategory.currentsilairate = Convert.ToDecimal(ds.Tables[0].Rows[0]["currentsilairate"]); } } } } } } catch (Exception ex) { ErrHandler.writeError(ex.Message, ex.StackTrace); return(null); } finally { ConnectionString.Close(); } return(objcategory); }
public Int64 Insert(employeewagesMaster objcategory) { Int64 result = 0; try { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "employeewages_Insert"; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = ConnectionString; SqlParameter param = new SqlParameter(); param.ParameterName = "@id"; //param.Value = objcategory.id; param.Value = 0; param.SqlDbType = SqlDbType.BigInt; param.Direction = ParameterDirection.InputOutput; cmd.Parameters.Add(param); cmd.Parameters.AddWithValue("@empid", objcategory.eid); cmd.Parameters.AddWithValue("@firstcount", objcategory.firstcount); cmd.Parameters.AddWithValue("@firstrate", objcategory.firstrate); cmd.Parameters.AddWithValue("@secondrate", objcategory.secondrate); cmd.Parameters.AddWithValue("@vshaperate", objcategory.vshaperate); cmd.Parameters.AddWithValue("@silairate", objcategory.silairate); cmd.Parameters.AddWithValue("@currentfirstrate", objcategory.currentfirstrate); cmd.Parameters.AddWithValue("@currentsecondrate", objcategory.currentsecondrate); cmd.Parameters.AddWithValue("@currentvshaperate", objcategory.currentvshaperate); cmd.Parameters.AddWithValue("@currentsilairate", objcategory.currentsilairate); ConnectionString.Open(); cmd.ExecuteNonQuery(); result = Convert.ToInt64(param.Value); } catch (Exception ex) { ErrHandler.writeError(ex.Message, ex.StackTrace); return(result); } finally { ConnectionString.Close(); } return(result); }