Ejemplo n.º 1
0
    private void Apply_Leave_Insert_Update()
    {
        try
        {
            DateTime D1 = DateTime.ParseExact(txtToDate.Text, "yyyy-MM-dd", null);
            DateTime D2 = DateTime.ParseExact(txtFromDate.Text, "yyyy-MM-dd", null);


            TimeSpan ts    = D1 - D2;
            TimeSpan time1 = TimeSpan.FromDays(1);
            ts = ts.Add(time1);

            ApplyLeaveEntity _objEntity = new ApplyLeaveEntity
            {
                leave_id = Convert.ToInt32(hf_id.Value.ToString()),
                emp_id   = Convert.ToInt32(hf_Emp_id.Value.ToString()),
                //emp_id = Emp_id,
                to_date       = txtToDate.Text.Trim(),
                from_date     = txtFromDate.Text.Trim(),
                calender_year = txtCalYear.Text.Trim(),
                no_of_days    = ts.Days.ToString(),
                leave_type    = dropleaveType.SelectedValue.Trim(),
                reason        = txtReason.Text.Trim(),
                CreatedBy     = hf_Emp_id.Value.ToString()
            };

            int IsSuccess = objDal.Apply_Leave_Insert_Update(_objEntity);
            if (IsSuccess > 0)
            {
                lblMsg.Text = CommanClass.ShowMessage("success", "Success", "Leave applyed successfully !!");
                SendMail(txtReason.Text, txtFromDate.Text, txtToDate.Text);
                Clear_text();
            }
            else
            {
                lblMsg.Text = CommanClass.ShowMessage("info", "Info", "Leave was applyed please try again!!");
            }
            Bing_Leaves(Convert.ToInt32(hf_Emp_id.Value.ToString()));
        }

        catch (Exception ex)
        {
            lblMsg.Text = CommanClass.ShowMessage("danger", "Error", ex.Message);
        }
    }
Ejemplo n.º 2
0
        public int Apply_Leave_Insert_Update(ApplyLeaveEntity ObjApplyLeave)
        {
            Hashtable hst = new Hashtable()
            {
                { "in_leave_id", ObjApplyLeave.leave_id },
                { "in_empid", ObjApplyLeave.emp_id },
                { "in_from_date", ObjApplyLeave.from_date },
                { "in_to_date", ObjApplyLeave.to_date },
                { "in_reason", ObjApplyLeave.reason },
                { "in_no_of_days", ObjApplyLeave.no_of_days },
                { "in_leave_type", ObjApplyLeave.leave_type },
                { "in_calender_year", ObjApplyLeave.calender_year },
                { "in_CreatedBy", ObjApplyLeave.CreatedBy },
            };
            int i = ExecuteNonQuery("leave_details_insert_update", hst);

            return(i);
        }