예제 #1
0
파일: Car.cs 프로젝트: TranTan90/hana
        /// <summary>
        /// 차량 입출문 등록
        /// </summary>
        /// <param name="carVisitDataInfo"></param>
        /// <returns></returns>
        public int insertCarVisitData(String type, CarVisitDataInfo carVisitDataInfo)
        {
            log.Debug("=================START insertCarVisitData=================");
            log.Debug("type = " + type.ToString());
            log.Debug("carVisitDataInfo = " + carVisitDataInfo.ToString());

            StringBuilder sql = new StringBuilder();

            if (type.Equals("input"))
            {
                sql.Append(@"INSERT INTO CarVisitData (carCode,inTime,employeeName,etc,regDate,carHandlerCode)
                        VALUES (" + carVisitDataInfo.CarDataInfo.CarCode + ",GETDATE(),N'" + carVisitDataInfo.EmployeeName + "',N'" + carVisitDataInfo.Etc + "(지급)',GETDATE()," + carVisitDataInfo.CarHandlerInfo.CarHandlerCode + ")");
            }
            else
            {
                sql.Append(@"INSERT INTO CarVisitData (carCode,outTime,employeeName,etc,regDate,carHandlerCode)
                        VALUES (" + carVisitDataInfo.CarDataInfo.CarCode + ",GETDATE(),N'" + carVisitDataInfo.EmployeeName + "',N'" + carVisitDataInfo.Etc + "',GETDATE()," + carVisitDataInfo.CarHandlerInfo.CarHandlerCode + ")");
            }

            int result = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sql.ToString(), null);

            return(result);

            log.Debug("=================END insertCarVisitData=================");
        }
예제 #2
0
    protected void btnOutput_Click(object sender, EventArgs e)
    {
        CarVisitDataInfo carVisitDataInfo = new CarVisitDataInfo();

        carVisitDataInfo.CarDataInfo    = new CarDataInfo();
        carVisitDataInfo.CarHandlerInfo = new CarHandlerInfo();

        if (Request.Form["slHandler"].Equals("ADD"))
        {
            carHandler.CarCode = Convert.ToInt32(Request.Form["txtCarCode"]);
            carHandler.Handler = Request.Form["txthandler"];
            carHandler.Phone   = txtPhone.Text;

            bll.insertCarHandler(carHandler);
            carVisitDataInfo.CarHandlerInfo.CarHandlerCode = bll.selectMaxCarHandlerCode();
        }
        else
        {
            carVisitDataInfo.CarHandlerInfo.CarHandlerCode = Convert.ToInt32(Request.Form["txtHandlerCode"]);
        }

        carVisitDataInfo.CarDataInfo.CarCode = Convert.ToInt32(Request.Form["txtCarCode"]);
        carVisitDataInfo.EmployeeName        = txtEmployee.Text;
        carVisitDataInfo.Etc = txtEtc.Text;


        // 차량 출문 처리 (업무차)  xử lý xe ra cổng (xe công vụ )
        bll.insertCarVisitData("output", carVisitDataInfo);

        Page.RegisterClientScriptBlock("alert", JavaScriptBuilder.alert("Đã hoàn thành 처리 하였습니다.", "carVisitDataList.aspx"));
    }
예제 #3
0
    protected void GridView2_RowDataBound1(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            CarVisitDataInfo obj = (CarVisitDataInfo)e.Row.DataItem;

            e.Row.Cells[0].Text = obj.CarDataInfo.Number;
            e.Row.Cells[1].Text = bll.getCarTypeKor(obj.CarDataInfo.CarType);
            e.Row.Cells[2].Text = obj.CarDataInfo.CompanyName;
            e.Row.Cells[3].Text = obj.RegDate;
            e.Row.Cells[4].Text = obj.InTime;
            e.Row.Cells[5].Text = obj.OutTime;

            //if (obj.OutTime.Equals("-"))
            //{
            //    if (!obj.CarDataInfo.CarType.Equals("3"))
            //    {
            //        e.Row.Cells[5].Text = "<a href='#;' onClick=\"javascript:confirmMove('Bạn có muốn xử lý ra cổng không (출문 처리 하시겠습니까)?','../car/carVisitTimeUpdate.aspx?carVisitDataCode=" + obj.CarVistDataCode + "&keyWord=" + ddlKeyWord.SelectedValue + "&key=" + HttpUtility.UrlEncode(txtKey.Text) + "&page=" + GridView1.PageIndex + "')\">";
            //        e.Row.Cells[5].Text += "<span style=\"color:blue\">출문 처리</span></a>";
            //    }
            //    else e.Row.Cells[5].Text = "-";
            //}
            //else e.Row.Cells[5].Text = obj.OutTime.Substring(11, 8);

            e.Row.Cells[6].Text = obj.CarHandlerInfo.Handler;
            e.Row.Cells[7].Text = obj.CarHandlerInfo.Phone;
            e.Row.Cells[8].Text = obj.EmployeeName;
            e.Row.Cells[9].Text = obj.Etc;
        }
    }
예제 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Car bll = new Car();
        CarVisitDataInfo obj = new CarVisitDataInfo();

        obj.CarVistDataCode = Convert.ToInt32(Request.QueryString["carVisitDataCode"]);

        int result = bll.updateOutTime(obj.CarVistDataCode);

        //if (Request.QueryString["mode"].Equals("inTime"))
        //{
        //    int result = bll.updateInTime(obj);
        //}
        //else if (Request.QueryString["mode"].Equals("outTime"))
        //{
        //    int result = bll.updateOutTime(obj);
        //}

        String key = HttpUtility.UrlEncode(Request.QueryString["key"]);

        Page.RegisterClientScriptBlock("alert", JavaScriptBuilder.alert("Đã hoàn thành (처리 하였습니다).", "../security/carVisitDataList.aspx?keyWord=" + Request.QueryString["keyWord"] + "&key=" + key + "&page=" + Request.QueryString["page"]));
    }
예제 #5
0
 /// <summary>
 /// 차량 입출문 등록
 /// </summary>
 /// <param name="carVisitDataInfo"></param>
 /// <returns></returns>
 public int insertCarVisitData(String type, CarVisitDataInfo carVisitDataInfo)
 {
     return(dal.insertCarVisitData(type, carVisitDataInfo));
 }
예제 #6
0
파일: Car.cs 프로젝트: TranTan90/hana
        /// <summary>
        /// 차량 입출문 조회
        /// </summary>
        /// <param name="keyWord"></param>
        /// <param name="key"></param>
        /// <param name="searchStartDate"></param>
        /// <param name="searchEndDate"></param>
        /// <returns></returns>
        public List <CarVisitDataInfo> selectCarVisitDataList(String keyWord, String key, String searchStartDate, String searchEndDate)
        {
            log.Debug("=================START selectCarVisitDataList=================");

            List <CarVisitDataInfo> list = new List <CarVisitDataInfo>();

            StringBuilder sql = new StringBuilder();

            sql.Append(@"
                            SELECT	b.carCode,
		                            d.carCategoryCode,
		                            b.header,
		                            b.number,
		                            b.reject,
		                            b.rejectContent,
		                            b.carType,
		                            b.companyName,
		                            c.carHandlerCode,
		                            c.handler,
		                            c.handlerPhone,
		                            a.carVisitDataCode,
		                            CONVERT(varchar(19),a.inTime,120) AS inTime,
		                            CONVERT(varchar(19),a.outTime,120) AS outTime,
		                            a.employeeName,
		                            a.etc,
		                            a.regDate
                            FROM	CarVisitData a,
		                            CarData b,
		                            Carhandler c,
		                            CarCategory d
                            WHERE	a.carCode = b.carCode
	                                AND a.carHandlerCode = c.carHandlerCode
	                                AND b.carCategoryCode = d.carCategoryCode "    );

            if (!String.IsNullOrEmpty(key))
            {
                if (keyWord.Equals("handler"))
                {
                    sql.Append(" AND c." + keyWord + " LIKE '%" + key + "%' ");
                }
                else
                {
                    sql.Append(" AND b." + keyWord + " LIKE '%" + key + "%' ");
                }
            }

            if (!String.IsNullOrEmpty(searchStartDate) && !String.IsNullOrEmpty(searchEndDate))
            {
                sql.Append(" AND CONVERT(varchar(10),a.regDate,120) BETWEEN '" + searchStartDate + "' AND '" + searchEndDate + "'");
            }

            sql.Append(" ORDER BY a.carVisitDataCode DESC");

            //Execute the query against the database
            using (SqlDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sql.ToString(), null))
            {
                // Scroll through the results
                while (rdr.Read())
                {
                    CarVisitDataInfo obj = new CarVisitDataInfo();
                    obj = binCarVisitDataInfo(rdr, obj);

                    //Add each item to the arraylist
                    list.Add(obj);
                }
            }

            log.Debug("=================END selectCarVisitDataList=================");

            return(list);
        }
예제 #7
0
파일: Car.cs 프로젝트: TranTan90/hana
        private CarVisitDataInfo binCarVisitDataInfo(SqlDataReader rdr, CarVisitDataInfo obj)
        {
            obj.CarDataInfo    = new CarDataInfo();    // 차량정보
            obj.CarHandlerInfo = new CarHandlerInfo(); // 운전자 정보

            obj.CarDataInfo.CarCode         = rdr.GetInt32(0);
            obj.CarDataInfo.CarCategoryCode = rdr.GetInt16(1);

            if (rdr.IsDBNull(2))
            {
                obj.CarDataInfo.Header = null;
            }
            else
            {
                obj.CarDataInfo.Header = rdr.GetString(2);
            }

            obj.CarDataInfo.Number        = rdr.GetString(3);
            obj.CarDataInfo.Reject        = rdr.GetByte(4);
            obj.CarDataInfo.RejectContent = rdr.GetString(5);
            obj.CarDataInfo.CarType       = rdr.GetInt32(6).ToString();

            if (rdr.IsDBNull(7))
            {
                obj.CarDataInfo.CompanyName = null;
            }
            else
            {
                obj.CarDataInfo.CompanyName = rdr.GetString(7);
            }

            obj.CarHandlerInfo.CarHandlerCode = rdr.GetInt32(8);

            if (rdr.IsDBNull(9))
            {
                obj.CarHandlerInfo.Handler = null;
            }
            else
            {
                obj.CarHandlerInfo.Handler = rdr.GetString(9);
            }

            if (rdr.IsDBNull(10))
            {
                obj.CarHandlerInfo.Phone = null;
            }
            else
            {
                obj.CarHandlerInfo.Phone = rdr.GetString(10);
            }

            obj.CarVistDataCode = rdr.GetInt32(11);

            if (rdr.IsDBNull(12))
            {
                obj.InTime = "-";
            }
            else
            {
                obj.InTime = rdr.GetString(12);
            }
            //else obj.InTime = HanaMicron.COMS.Utility.DateUtility.getDateFormatColon(rdr.GetDateTime(12));

            if (rdr.IsDBNull(13))
            {
                obj.OutTime = "-";
            }
            else
            {
                obj.OutTime = rdr.GetString(13);
            }
            //else obj.OutTime = HanaMicron.COMS.Utility.DateUtility.getDateFormatColon(rdr.GetDateTime(13));

            if (rdr.IsDBNull(14))
            {
                obj.EmployeeName = null;
            }
            else
            {
                obj.EmployeeName = rdr.GetString(14);
            }

            if (rdr.IsDBNull(15))
            {
                obj.Etc = null;
            }
            else
            {
                obj.Etc = rdr.GetString(15);
            }

            obj.RegDate = rdr.GetDateTime(16).ToString("yyyy.MM.dd");

            return(obj);
        }
예제 #8
0
    protected void btnInput_Click(object sender, EventArgs e)
    {
        CarVisitDataInfo carVisitDataInfo = new CarVisitDataInfo();

        carVisitDataInfo.CarDataInfo    = new CarDataInfo();
        carVisitDataInfo.CarHandlerInfo = new CarHandlerInfo();
        int carCode        = 0;
        int carHandlerCode = 0;

        // 미등록 차량일 경우 신규 등록 Trường hợp xe chưa đăng ký thì đăng ký mới
        if (String.IsNullOrEmpty(Request.Form["txtCarCode"]))
        {
            carData.Header        = txtHeader.Text;
            carData.Number        = txtCarNumer.Text;
            carData.CarType       = Request.Form["slCarType"];
            carData.CompanyName   = Request.Form["companyName"];
            carData.Reject        = 0;
            carData.RejectContent = "";
            carData.CompanyCode   = Convert.ToInt32(Request.Form["companyCode"]);

            if (!bll.existsCarData(carData.Header, carData.Number, carData.CompanyCode))
            {
                // 임직원차(2), 내방객차(4) 일 경우 승용차로 고정(code 2)   / trường hợp xe nhân viên (2), xe khách thăm (4) thì cố định bằng xe chở khách
                if (carData.CarType.Equals("2") || carData.CarType.Equals("4"))
                {
                    carData.CarCategoryCode = 2;
                }
                else
                {
                    carData.CarCategoryCode = 17;  //그외 입출문 관리에서 등록할 경우 납품차로 고정(트럭:code 17)  / Ngoài ra Trong quản lý xe ra vào cổng, trường hợp chưa đăng ký thì cố định bằng xe giao hàng
                }
                if (!String.IsNullOrEmpty(carData.Header) && !String.IsNullOrEmpty(carData.Number))
                {
                    if (!String.IsNullOrEmpty(carData.CompanyName))
                    {
                        if (!String.IsNullOrEmpty(Request.Form["txthandler"]))
                        {
                            // 차량 정보 등록 Đăng ký thông tin xe
                            int result = bll.insertCarData(carData);
                            carCode = bll.selectMaxCarCode();

                            carHandler.CarCode = carCode;
                            carHandler.Handler = Request.Form["txthandler"];
                            carHandler.Phone   = txtPhone.Text;

                            // 운전자 등록  Đăng ký lái xe
                            bll.insertCarHandler(carHandler);
                            carHandlerCode = bll.selectMaxCarHandlerCode();

                            carVisitDataInfo.CarDataInfo.CarCode = carCode;
                            carVisitDataInfo.EmployeeName        = txtEmployee.Text;
                            carVisitDataInfo.Etc = txtEtc.Text;
                            carVisitDataInfo.CarHandlerInfo.CarHandlerCode = carHandlerCode;

                            // 차량 입문 처리  Xử lý xe vào cổng
                            bll.insertCarVisitData("input", carVisitDataInfo);

                            Page.RegisterClientScriptBlock("alert", JavaScriptBuilder.alert("Đã hoàn thành (처리 하였습니다).", "carVisitDataList.aspx"));
                        }
                        else
                        {
                            Page.RegisterStartupScript("alertMsg", JavaScriptBuilder.alert("Hãy nhập tên lái xe (운전자 이름을 입력하여 주세요)."));
                        }
                    }
                    else
                    {
                        Page.RegisterStartupScript("alertMsg", JavaScriptBuilder.alert("Hãy nhập tên công ty (회사명을 입력하여 주세요)."));
                    }
                }
                else
                {
                    Page.RegisterStartupScript("alertMsg", JavaScriptBuilder.alert("Hãy nhập số xe (차량번호를 입력하여 주세요)."));
                }
            }
            else
            {
                Page.RegisterStartupScript("alertMsg", JavaScriptBuilder.alert("Xe đã được đăng ký trước. Hãy kiểm tra lại (이미등록된 차량입니다. 확인하여 주세요)."));
            }
            // 차량 정보 등록  Đăng ký thông tin xe
            //int result = bll.insertCarData(carData);
            //carCode = bll.selectMaxCarCode();

            //carHandler.CarCode = carCode;
            //carHandler.Handler = Request.Form["txthandler"];
            //carHandler.Phone = txtPhone.Text;

            // 운전자 등록 Đăng ký lái xe
            //bll.insertCarHandler(carHandler);
            //carHandlerCode = bll.selectMaxCarHandlerCode();

            //carVisitDataInfo.CarDataInfo.CarCode = carCode;
            //carVisitDataInfo.EmployeeName = txtEmployee.Text;
            //carVisitDataInfo.Etc = txtEtc.Text;
            //carVisitDataInfo.CarHandlerInfo.CarHandlerCode = carHandlerCode;
        }
        else // 기존 등록된 차량일 경우   trường hợp xe đã được đăng ký trước
        {
            carCode = Convert.ToInt32(Request.Form["txtCarCode"]);

            // 2010-05-19-임종우 : 헤더 없는 차량은 수정 가능하도록 변경.     Thay đổi để có thể sửa xe không có header
            carData.Header  = txtHeader.Text;
            carData.CarCode = carCode;

            //운전자 추가  Thêm lái xe
            if (Request.Form["slHandler"].Equals("ADD"))
            {
                carHandler.CarCode = carCode;
                carHandler.Handler = Request.Form["txthandler"];
                carHandler.Phone   = txtPhone.Text;

                // 2010-05-18-임종우 : 해당 차량에 운전자 등록 되어 있는지 체크   check xem xe đó đã được đăng ký lái xe chưa
                if (!bll.existsCarHandlerData(carHandler.CarCode, carHandler.Handler))
                {
                    // 2010-05-29-임종우 : 차량 헤더 없는것은 수정 가능하도록 추가   Thêm khả năng sửa đổi xe không có deader
                    if (Request.Form["txtUpdate"] == "yes")
                    {
                        bll.updateCarData_header(carData);
                    }

                    // 운전자 등록 đăng ký lái xe
                    bll.insertCarHandler(carHandler);
                    carHandlerCode = bll.selectMaxCarHandlerCode();

                    carVisitDataInfo.CarDataInfo.CarCode = carCode;
                    carVisitDataInfo.EmployeeName        = txtEmployee.Text;
                    carVisitDataInfo.Etc = txtEtc.Text;
                    carVisitDataInfo.CarHandlerInfo.CarHandlerCode = carHandlerCode;

                    // 차량 입문 처리 hoàn thành xe vào cổng
                    bll.insertCarVisitData("input", carVisitDataInfo);

                    Page.RegisterClientScriptBlock("alert", JavaScriptBuilder.alert("Đã hoàn thành (처리 하였습니다).", "carVisitDataList.aspx"));
                }
                else
                {
                    Page.RegisterClientScriptBlock("alert", JavaScriptBuilder.alert(carHandler.Handler + "là lái xe đã được đăng ký. Hãy kiểm tra lại. (님은 이미 등록 된 운전자 입니다.\\n다시 확인 하시기 바랍니다).", "carVisitDataList.aspx"));
                    //Page.RegisterStartupScript("alertMsg", JavaScriptBuilder.alert(carHandler.Handler + "님은 이미 등록 된 운전자 입니다."));
                }
            }
            else
            {
                // 2010-05-29-임종우 : 차량 헤더 없는것은 수정 가능하도록 추가    Thêm khả năng sửa đổi xe không có deader
                if (Request.Form["txtUpdate"] == "yes")
                {
                    bll.updateCarData_header(carData);
                }

                carHandlerCode = Convert.ToInt32(Request.Form["txtHandlerCode"]);

                carVisitDataInfo.CarDataInfo.CarCode = carCode;
                carVisitDataInfo.EmployeeName        = txtEmployee.Text;
                carVisitDataInfo.Etc = txtEtc.Text;
                carVisitDataInfo.CarHandlerInfo.CarHandlerCode = carHandlerCode;

                //차량 입문 처리 시 전화번호 업데이트     Xử lý xe vào cổng thì update số điện thoại
                carHandler.CarHandlerCode = Convert.ToInt32(Request.Form["txtHandlerCode"]);
                //carHandler.CarCode = carCode;
                //carHandler.Handler = Request.Form["txtHandler"];
                carHandler.Phone = txtPhone.Text;
                bll.updateCarHandlerPhone(carHandler);

                // 차량 입문 처리  xử lý xe vào cổng
                bll.insertCarVisitData("input", carVisitDataInfo);
                Page.RegisterClientScriptBlock("alert", JavaScriptBuilder.alert("Đã hoàn thành (처리 하였습니다).", "carVisitDataList.aspx"));
            }
        }

        // 차량 입문 처리
        //bll.insertCarVisitData("input",carVisitDataInfo);

        //Page.RegisterClientScriptBlock("alert", JavaScriptBuilder.alert("처리 하였습니다.", "carVisitDataList.aspx"));
    }